# coding:utf-8
__author__ = 'chenghao'
from xpinyin import Pinyin
import logging
import logging.handlers

c = {
	"zhongguowang": {  # 中国网
		"title_re": ".Left .artTitle",
		"content_re": ".Left #artbody",
	},
	"souhu": {  # 搜狐
		"title_re": ".content-wrapper h1",
		"content_re": "#contentText",
	},
	"xinlang": {  # 新浪
		"title_re": "#artibodyTitle",
		"content_re": "#artibody",
	},
	"yichewang": {  # 易车网

	},
	"zhongguoqingnianwang": {  # 中国青年网
		"title_re": ".main_l .l_tit",
		"content_re": ".main_l .content",
		"replace_1": "./",
		"replace_2": "./",
	},
	"qichezhijia": {  # 汽车之家

	},
	"renminwang": {  # 人民网
		"title_re": "#p_title",
		"content_re": "#p_content",
	},
	"zhongguoribaowang": {  # 中国日报网
		"title_re": "#title",
		"content_re": "#Zoom",
	},
	"wangyi": {  # 网易

	},
	"xinhuawang": {  # 新华网
		"title_re": "#title",
		"content_re": "#article .article",
		"replace_1": 'src="',
		"replace_2": "./2",
	},
	"zhongguojingjiwang": {  # 中国经济网
		"title_re": "#articleTitle",
		"content_re": "#articleText",
		"replace_1": './',
		"replace_2": "./",
	},
	"huanqiuwang": {  # 环球网
		"title_re": ".conText h1",
		"content_re": ".conText #text",
	},
	"guangmingwang": {  # 光明网 #
		"title_re": ".contentLeft #articleTitle",
		"content_re": ".contentLeft #contentMain",
	},
	"zhongguozhengfuwang": {  # 中国政府网

	},
	"zhongguoguangbowang": {  # 中国广播网
		"title_re": "#cntl .f22.lh30.yahei",
		"content_re": "#cntl .sanji_left .f16.lh32.yahei.left",
		"replace_1": "./",
		"replace_2": "./",
	},
	"tengxun": {  # 腾讯
		"title_re": "#C-Main-Article-QQ .hd h1",
		"content_re": "#Cnt-Main-Article-QQ",
	},
	"fenghuangwang": {  # 凤凰网

	},
	"zhongguoxinwenwang": {  # 中国新闻网
		"title_re": "#cont_1_1_2 h1",
		"content_re": "#cont_1_1_2 .left_zw",
	},
}

'''
# 按每天生成日志文件 linux (win是存放在该项目的所在盘下)
logHandler = logging.handlers.TimedRotatingFileHandler("D:/thirdparty_api/logs/search_news", "D", 1)
# 格式化日志内容
logFormatter = logging.Formatter('%(asctime)s %(name)-5s %(levelname)-5s %(message)s')
logHandler.setFormatter(logFormatter)
# 设置记录器名字
logger = logging.getLogger('search_news')
logger.addHandler(logHandler)
# 设置日志等级
logger.setLevel(logging.INFO)
'''

p = Pinyin()


def pinyin(s):
	return p.get_pinyin(s, '')


if __name__ == "__main__":
	print pinyin(unicode("中国网", "utf-8"))
	print pinyin(unicode("搜狐", "utf-8"))
	print pinyin(unicode("新浪", "utf-8"))
	print pinyin(unicode("易车网", "utf-8"))
	print pinyin(unicode("中国青年网", "utf-8"))
	print pinyin(unicode("汽车之家", "utf-8"))
	print pinyin(unicode("人民网", "utf-8"))
	print pinyin(unicode("中国日报网", "utf-8"))
	print pinyin(unicode("网易", "utf-8"))
	print pinyin(unicode("新华网", "utf-8"))

	print pinyin(unicode("中国经济网", "utf-8"))
	print pinyin(unicode("环球网", "utf-8"))
	print pinyin(unicode("光明网", "utf-8"))
	print pinyin(unicode("中国政府网", "utf-8"))
	print pinyin(unicode("中国广播网", "utf-8"))
	print pinyin(unicode("腾讯", "utf-8"))
	print pinyin(unicode("凤凰网", "utf-8"))
	print pinyin(unicode("中国新闻网", "utf-8"))

